/*
 * File: KafkaKeySerializer.java Author: Fating <xingon@163.com>
 * 
 * Created on 2014年11月13日下午2:00:21
 * 
 * Copyright (c) 2014, www.vip.com All Rights Reserved.
 */
package com.tc.vms.kafka;

import kafka.serializer.Encoder;
import kafka.utils.VerifiableProperties;

import java.io.UnsupportedEncodingException;

public class KafkaKeySerializer implements Encoder<String> {

    public KafkaKeySerializer(VerifiableProperties properties) {

    }

    @Override
    public byte[] toBytes(String msg) {
        try {
            return msg == null ? null : msg.getBytes("utf-8");
        } catch (UnsupportedEncodingException e) {
            return null;
        }
    }
}
